<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="程序员的快乐小网站">
  <link 
    rel="icon" 
    href="https://demo.theme-kaze.top/img/Kaze.png">
  <title>路由与交换技术（2）_虚拟局域网（VLAN）技术（下）</title>
  
    
      <meta 
        property="og:title" 
        content="路由与交换技术（2）_虚拟局域网（VLAN）技术（下）">
    
    
      <meta 
        property="og:url" 
        content="http://www.baikaihua.gitee.io/2021/11/08/%E8%B7%AF%E7%94%B1%E4%B8%8E%E4%BA%A4%E6%8D%A2%E6%8A%80%E6%9C%AF%EF%BC%882%EF%BC%89_%E8%99%9A%E6%8B%9F%E5%B1%80%E5%9F%9F%E7%BD%91%EF%BC%88VLAN%EF%BC%89%E6%8A%80%E6%9C%AF%EF%BC%88%E4%B8%8B%EF%BC%89/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://gitee.com/baikaihua/tochang/raw/master/src=http___b-ssl.duitang.com_uploads_item_201607_07_20160707163006_EnLeG.jpeg&amp;refer=http___b-ssl.duitang.jpg">
    
    
      <meta 
        property="og:img" 
        content="&lt;p&gt;文章内容源自我对华为信息与网络技术学院教材中《路由与交换技术》一书的提炼与总结。本篇内容介绍了交VLAN中的一些概念和应用。&lt;/p&gt;
&lt;p&gt;整理：白开画&lt;/p&gt;">
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2021-11-08">
      <meta 
        property="og:article:modified_time" 
        content="2021-11-07">
      <meta 
        property="og:article:author" 
        content="白开画 and 徐威">
      
        
          <meta 
            property="og:article:tag" 
            content="网络">
        
          <meta 
            property="og:article:tag" 
            content="白开画">
        
          <meta 
            property="og:article:tag" 
            content="华为">
        
          <meta 
            property="og:article:tag" 
            content="路由交换">
        
          <meta 
            property="og:article:tag" 
            content="华为认证">
        
          <meta 
            property="og:article:tag" 
            content="VLAN">
        
          <meta 
            property="og:article:tag" 
            content="GVRP">
        
      
    
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
      }
    };
    setDarkmode();
    </script>
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lozad.min.js" as="script">
  
  
  
  
    
    <link rel="prefetch" href="//cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" as="script">
  
  
    
    <link rel="prefetch" href="//unpkg.com/valine/dist/Valine.min.js" as="script">
  
  
  
  <link rel="stylesheet" href="/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
    <link rel="stylesheet" href="/js/lib/lightbox/baguetteBox.min.css">
  
<meta name="generator" content="Hexo 5.4.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <span class="navbar-logo-main">
      
        <img 
          class="navbar-logo-img" 
          src="https://demo.theme-kaze.top/img/Kaze.png" 
          alt="blog logo">
      
      <span class="navbar-logo-dsc">程序小站</span>
    </span>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
    <a 
      class="navbar-menu-item darknavbar" 
      id="dark">
      <i class="iconfont icon-weather"></i>
    </a>
    <a 
      class="navbar-menu-item searchnavbar" 
      id="search">
      <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i>
    </a>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <main class="main-column">
<article class="card card-content">
  <header>
    <h1 class="post-title">
      路由与交换技术（2）_虚拟局域网（VLAN）技术（下）
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2021-11-08T13:30:05.360Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2021-11-08</span>
    </time>
    
      <span class="dot"></span>
      
        <a 
          href="/categories/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/" 
          class="post-meta-link">
          路由交换
        </a>
      
    
    
      <span class="dot"></span>
      <span>2.4k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/tags/%E7%BD%91%E7%BB%9C/" 
            class="post-meta-link">
            网络
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E7%99%BD%E5%BC%80%E7%94%BB/" 
            class="post-meta-link">
            白开画
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E5%8D%8E%E4%B8%BA/" 
            class="post-meta-link">
            华为
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/" 
            class="post-meta-link">
            路由交换
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E5%8D%8E%E4%B8%BA%E8%AE%A4%E8%AF%81/" 
            class="post-meta-link">
            华为认证
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/VLAN/" 
            class="post-meta-link">
            VLAN
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/GVRP/" 
            class="post-meta-link">
            GVRP
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <p>文章内容源自我对华为信息与网络技术学院教材中《路由与交换技术》一书的提炼与总结。本篇内容介绍了交VLAN中的一些概念和应用。</p>
<p>整理：白开画</p>
<span id="more"></span>
<h2 id="valn的添加与删除"><a class="markdownIt-Anchor" href="#valn的添加与删除"></a> VALN的添加与删除</h2>
<h3 id="valn常用命令"><a class="markdownIt-Anchor" href="#valn常用命令"></a> VALN常用命令</h3>
<ol>
<li>
<p><strong>vlan</strong>  [vlan-id]：管理员可以在系统视图下，使用这条命令创建的单个VALN，参数vlan-id的取值范围是1~4094；</p>
<p>（1）VLAN 1是默认存在的VLAN，因此无需管理手动添加，初始状态所有接口都属于VLAN 1，管理员也无法删除VLAN 1。</p>
</li>
<li>
<p><strong>vlan batch</strong> {vlan-id1 vlan-id2}：管理员可以在系统视图下，使用此命令创建多个VLAN。</p>
<p>（1）这些VLAN的号码不必连续，每个VLAN号码之间插入空格即可。如，想要创建VLAN 8和VLAN 10就可以使用命令vlan batch 8 10。</p>
</li>
<li>
<p><strong>vlan batch</strong> {vlan-id1[<strong>to</strong>  valn-id2]}：管理员可以在系统视图下，使用这条命令创建多个连续的VALN，在首位VLAN编号之间加入关键字<strong>to</strong>。</p>
</li>
<li>
<p><strong>description</strong> <TEXT>：添加一条描述信息。</p>
</li>
<li>
<p><strong>undo vlan</strong> <vlan-id>：删除指定VALN。</p>
</li>
<li>
<p><strong>display</strong> <strong>vlan</strong> [vlan-id]：用来查看VALN配置信息。</p>
</li>
</ol>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211102175537.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211102175537.jpg" class="lozad post-image"></p>
<h3 id="实验一基于端口的vlan配置"><a class="markdownIt-Anchor" href="#实验一基于端口的vlan配置"></a> 实验一：基于端口的vlan配置</h3>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%871.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%871.jpg" class="lozad post-image"></p>
<pre class="highlight"><span class="line">&lt;Huawei&gt;	</span><br><span class="line">&lt;Huawei&gt;<span class="keyword">system</span>-<span class="keyword">view</span></span><br><span class="line">[Huawei]vlan batch <span class="number">10</span> <span class="number">20</span>                 //批量建立vlan10 <span class="number">20</span></span><br><span class="line">[Huawei]interface g0/<span class="number">0</span>/<span class="number">1</span>                //进入端口g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type access   //设置端口的连接类型为access</span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port default vlan <span class="number">10</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]quit</span><br><span class="line">[Huawei]interface g0/<span class="number">0</span>/<span class="number">2</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port link-type access   </span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port default vlan <span class="number">10</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]quit</span><br><span class="line">[Huawei]display vlan                //查看端口是否加入到了vlan中</span><br><span class="line">Vlan20加入端口的配置与上面类似。</span><br></pre>
<p>同样把3端口和4端口也加入到vlan20中。</p>
<p>测试：相同vlan内的主机能够相互通信，不同vlan内不能相互通信。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%872.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%872.jpg" class="lozad post-image"></p>
<h2 id="access接口与trunk接口的配置"><a class="markdownIt-Anchor" href="#access接口与trunk接口的配置"></a> Access接口与Trunk接口的配置</h2>
<h3 id="基本概念"><a class="markdownIt-Anchor" href="#基本概念"></a> 基本概念</h3>
<ol>
<li>
<p>接口模式有3种：Access（接入）接口、Trunk（干道）接口和Hybrid（混用）接口。</p>
</li>
<li>
<p>Access接口：用于连接终端设备。</p>
<p>（1）Access接口只能属于一个VLAN，也只能传输一个VLAN的数据。</p>
<p>（2）Access接口在从直连设备收到入站数据帧后，会判断这个数据帧是否携带VLAN标签，若不携带，则为数据帧插入本接口的PVID并进行下一步处理；若携带则判断数据帧的VLAN ID是否与本接口的PVID相同，若相同者就那些下一步处理，若不同则丢弃。</p>
<p>（3）Access接口在发送出站数据帧之前，会判断这个要被转发的数据帧中携带的VALN ID是否与出站接口的PVID相同，若相同则去掉VALN标签进行转发；若不同则丢弃；</p>
<p>（4）<strong>PVID的作用只是在交换机从外部接受到可以接受Untagged 数据帧的时候给数据帧添加TAG标记用的，在交换机内部转发数据的时候PVID不起任何作用</strong></p>
</li>
<li>
<p>Trunk 接口：用于连接交换机。</p>
<p>（1）Trunk接口允许传输多个VLAN的数据。</p>
<p>（2）Trunk接口在从直连设备收到入站数据帧后，会判断这个数据帧是否携带VLAN标签，若不携带，则为数据帧插入本接口的PVID并进行下一步处理；若携带，则判断本接口是否允许传输这个数据帧的VALN ID，若允许则进行下一步处理，否则丢弃。</p>
<p>（3）Trunk接口在发数据帧之前，会判断这个要被转发的数据帧中携带的VLAN ID是否与出站接口的PVID相同，若相同则去掉VLAN标签进行转发；若不同则判断本接口是否允许传输这个数据帧的VLAN ID，若允许则转发，否则丢弃。</p>
</li>
</ol>
<h3 id="常用命令"><a class="markdownIt-Anchor" href="#常用命令"></a> 常用命令</h3>
<ol>
<li><strong>port link-typc</strong> &lt;接口的链路类型&gt; ：这条命令的作用是修改接口的链路状态（默认为<strong>Hybrid</strong>）。</li>
<li><strong>port trunk allow-pass vlan</strong> { { vlan-id1 [ vlan-id2 ] } | all }：管理员通过这条命令可以同时放行多个VALN的流量，使用关键字all可以放行所有流量。</li>
<li><strong>port default vlan</strong> <valn-id>：将接口的PVID更改为VALN 5。</li>
</ol>
<h3 id="实验二跨交换机的相同vlan通信trunk"><a class="markdownIt-Anchor" href="#实验二跨交换机的相同vlan通信trunk"></a> 实验二：跨交换机的相同vlan通信（trunk）</h3>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%873.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%873.jpg" class="lozad post-image"></p>
<pre class="highlight"><span class="line">交换机<span class="number">1</span>：S1</span><br><span class="line">&lt;Huawei&gt; sy</span><br><span class="line">[Huawei]sy	</span><br><span class="line">[Huawei]sysname S1                      //交换机改名</span><br><span class="line">[S1]undo info-center enable                //关闭信息提示</span><br><span class="line"></span><br><span class="line">把端口<span class="number">1</span>加入到vlan10中：</span><br><span class="line">[S1]vlan batch <span class="number">10</span> <span class="number">20</span>                     //建立vlan10和vlan20</span><br><span class="line">[S1]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type access  </span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port default vlan <span class="number">10</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]quit</span><br><span class="line"></span><br><span class="line">把端口<span class="number">2</span>加入到vlan20中：</span><br><span class="line">[S1]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">2</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port link-type access</span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port default vlan <span class="number">20</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]dis this</span><br><span class="line"></span><br><span class="line">设置<span class="number">24</span>口为trunk口，并允许vlan10和<span class="number">20</span>的流量通过：</span><br><span class="line">[S1]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">24</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port link-type trunk </span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port trunk allow-pass vlan <span class="number">10</span> <span class="number">20</span>  //允许通过vlan10和<span class="number">20</span></span><br><span class="line">[S1-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]quit</span><br><span class="line">[S1]quit</span><br><span class="line">&lt;S1&gt;<span class="keyword">save</span>	</span><br><span class="line"></span><br><span class="line">交换机<span class="number">2</span>：S2  （与交换机S1配置类似）</span><br><span class="line">&lt;Huawei&gt;sy</span><br><span class="line">[Huawei]sysname S2</span><br><span class="line"></span><br><span class="line">[S2]vlan batch <span class="number">10</span> <span class="number">20</span></span><br><span class="line">[S2]interface g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type access </span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port default vlan <span class="number">10</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]quit</span><br><span class="line">[S2]interface g0/<span class="number">0</span>/<span class="number">2</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port link-type access </span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port default vlan <span class="number">20</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]dis this</span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]quit</span><br><span class="line">[S2]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">24</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port link-type trunk </span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port trunk allow-pass vlan <span class="number">10</span> <span class="number">20</span></span><br><span class="line">[S2-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]quit</span><br><span class="line">[S2]quit</span><br><span class="line">&lt;S2&gt;<span class="keyword">save</span></span><br></pre>
<p>测试：</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%874.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%874.jpg" class="lozad post-image"></p>
<h2 id="hybrid接口的原理与配置"><a class="markdownIt-Anchor" href="#hybrid接口的原理与配置"></a> Hybrid接口的原理与配置</h2>
<h3 id="hybrid接口原理"><a class="markdownIt-Anchor" href="#hybrid接口原理"></a> Hybrid接口原理</h3>
<ol>
<li>这种接口能够接收和发送多个VLAN的数据，可以用于连接交换机之间的链路，也可以用于连接交换机与终端设备。</li>
<li>Trunk接口和Hybrd接口的区别：在入站时处理方法相同。在出站时，当数据所属VLAN等于Trunk接口的PVID时，Trunk接口会去掉VLAN标签进行转发，而Hybrid接口能够以不携带VLAN标签的方式发送多个VLAN的数据。</li>
</ol>
<h3 id="常用命令-2"><a class="markdownIt-Anchor" href="#常用命令-2"></a> 常用命令</h3>
<ol>
<li><strong>port link-type hybrid</strong>：将接口链路改为Hybrid，华为交换机接口的缺省链路类型就是Hybrid；</li>
<li><strong>port hybrid tagged vlan</strong> { { vlan-id1 [ <strong>to</strong> vlan-id2 ] <strong>all</strong> } ：设置转发哪些VLAN的数据时，需要携带VLAN标签；</li>
<li><strong>port hybrid untagged vlan</strong> { { vlan-id1 [ <strong>to</strong> vlan-id2 ] <strong>all</strong> } ：设置转发哪些VLAN的数据时，需要摘除VLAN标签；</li>
<li><strong>port hybrid pvid vlan</strong> <vlan-id> ：配置该接口的缺省VLAN。如果该接口接收到了不携带VLAN标签的数据，那么交换机就会默认为这些数据帧属于该接口的缺省VLAN，从而为这种流量打上相应的VLAN标签；</li>
</ol>
<h3 id="实验三交换机hybrid接口实验"><a class="markdownIt-Anchor" href="#实验三交换机hybrid接口实验"></a> 实验三：交换机Hybrid接口实验</h3>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%875.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%875.jpg" class="lozad post-image"></p>
<pre class="highlight"><span class="line">&lt;Huawei&gt;</span><br><span class="line">&lt;Huawei&gt;<span class="keyword">system</span>-<span class="keyword">view</span> </span><br><span class="line">[Huawei]undo info-center enable </span><br><span class="line">[Huawei]vlan batch <span class="number">10</span> <span class="number">20</span> <span class="number">30</span> <span class="number">40</span>       //批量建立vlan10 <span class="number">20</span> <span class="number">30</span> <span class="number">40</span></span><br><span class="line">[Huawei]</span><br><span class="line">[Huawei]interface g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type hybrid      //设置端口类型为hybrid（默认）</span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port hybrid pvid vlan <span class="number">10</span>    //把<span class="number">0</span>/<span class="number">0</span>/<span class="number">1</span>端口的pvid设置为<span class="number">10</span>（把该端口加入到vlan10中）</span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port hybrid untagged vlan <span class="number">10</span> <span class="number">30</span> <span class="number">40</span></span><br><span class="line">                               //设置vlan10 <span class="number">30</span> <span class="number">40</span>的流量不打标签能够通过端口<span class="number">1</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]quit</span><br><span class="line">[Huawei]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">2</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port link-type hybrid </span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port hybrid pvid vlan <span class="number">20</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port hybrid untagged vlan <span class="number">20</span> <span class="number">40</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]quit</span><br><span class="line">[Huawei]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">3</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">3</span>]port link-type hybrid </span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">3</span>]port hybrid pvid vlan <span class="number">30</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">3</span>]port hybrid untagged vlan <span class="number">10</span> <span class="number">30</span> <span class="number">40</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">3</span>]quit</span><br><span class="line">[Huawei]<span class="keyword">int</span> g0/<span class="number">0</span>/<span class="number">24</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port link-type hybrid </span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port hybrid pvid vlan <span class="number">40</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]port hybrid untagged vlan <span class="number">10</span> <span class="number">20</span> <span class="number">30</span> <span class="number">40</span></span><br><span class="line">[Huawei-GigabitEthernet0/<span class="number">0</span>/<span class="number">24</span>]quit</span><br></pre>
<p>测试：</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%876.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%876.jpg" class="lozad post-image"></p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%872.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/%E5%9B%BE%E7%89%872.jpg" class="lozad post-image"></p>
<h2 id="检查vlan信息"><a class="markdownIt-Anchor" href="#检查vlan信息"></a> 检查VLAN信息</h2>
<h3 id="常用命令-3"><a class="markdownIt-Anchor" href="#常用命令-3"></a> 常用命令</h3>
<ol>
<li><strong>display vlan</strong> [ vlan-id [ <strong>verbose</strong> ] ] ：查看特定VALN的详细信息，包括VLAN类型、VLAN状态、所包含的接口，以及这些接口的状态；</li>
<li><strong>display vlan</strong> <vlan-id> <strong>statistics</strong> ：查看指定VLAN的流量统计信息；</li>
<li><strong>display vlan summary</strong> ：查看交换机中所以VLAN的汇总信息；</li>
</ol>
<h3 id="基于实验三的案例"><a class="markdownIt-Anchor" href="#基于实验三的案例"></a> 基于实验三的案例</h3>
<ol>
<li>
<p><strong>display vlan 10</strong>：</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211103215744.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211103215744.jpg" class="lozad post-image"></p>
<p>（1）可以看到允许VLAN 10流量通行的接口有GE0/0/1 、GE0/0/2和GE0/0/3。</p>
<p>（2）<strong>UT</strong>和<strong>TG</strong>：UT的意思是不携带VLAN标签，TG的意思则是携带VALN标签。也就是说，UT后面列出的接口发送数据时会吧VLAN标签摘除，而TG后面列出的接口发送数据时保留VLAN标签。</p>
<p>（3）接口后面括号中的字母U和D表示该接口的工作状态，U表示接口正在工作，D表示接口未工作。</p>
</li>
<li>
<p><strong>display vlan 10 verbose</strong>：</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107160910.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107160910.jpg" class="lozad post-image"></p>
</li>
<li>
<p><strong>display vlan 10 statistics</strong> ：</p>
<p>​		如果管理员希望通过此命令查看VLAN 10的流量统计信息，则首先在响应VLAN的系统视图下使用<strong>statistics enable</strong>来启动该VLAN的流量统计功能。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107161652.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107161652.jpg" class="lozad post-image"></p>
</li>
<li>
<p><strong>display vlan summary</strong> ：</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107161834.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107161834.jpg" class="lozad post-image"></p>
</li>
</ol>
<h2 id="gvrp的配置"><a class="markdownIt-Anchor" href="#gvrp的配置"></a> GVRP的配置</h2>
<h3 id="实验四gvrp配置"><a class="markdownIt-Anchor" href="#实验四gvrp配置"></a> 实验四：GVRP配置</h3>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107163111.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107163111.jpg" class="lozad post-image"></p>
<p>1.对所有交换机全局模式下和接口模式下启用GVRP。</p>
<pre class="highlight"><span class="line">[SW1]gvrp</span><br><span class="line">[SW1]interface g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[SW1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type trunk</span><br><span class="line">[SW1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port trunk allow-pass vlan all</span><br><span class="line">[SW1-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]gvrp</span><br><span class="line"></span><br><span class="line">[SW2]gvrp</span><br><span class="line">[SW2]interface g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type trunk </span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port trunk allow-pass vlan all</span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]gvrp</span><br><span class="line">[SW2]interface g0/<span class="number">0</span>/<span class="number">2</span></span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port link-type trunk </span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]port trunk allow-pass vlan all</span><br><span class="line">[SW2-GigabitEthernet0/<span class="number">0</span>/<span class="number">2</span>]gvrp</span><br><span class="line"></span><br><span class="line">[SW3]gvrp</span><br><span class="line">[SW3]interface g0/<span class="number">0</span>/<span class="number">1</span></span><br><span class="line">[SW3-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port link-type trunk </span><br><span class="line">[SW3-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]port trunk allow-pass vlan all</span><br><span class="line">[SW3-GigabitEthernet0/<span class="number">0</span>/<span class="number">1</span>]gvrp</span><br></pre>
<blockquote>
<p>启用GVRP特性的接口默认使用Normal注册模式。</p>
</blockquote>
<p>2.测试</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107165604.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107165604.jpg" class="lozad post-image"></p>
<p>​		VLAN 10在SW2上的类型是Dynamic（动态VLAN），且GE0/0/1接口可以传输VLAN 10的流量。</p>
<p>​		因为GVRP的注册和删除过程都是单向的，只有接收到VLAN信息的接口会加入到这个VLAN，为了使VLAN 10的流量可以在拓扑中顺利传输，我们通过在SW3上创建VLAN 10的方法，让SW2的GE0/0/2接口自动放行VALN 10。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107170739.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211107170739.jpg" class="lozad post-image"></p>

  </div>
  <div>
    
      <div 
        class="post-note note-warning copyright" 
        style="margin-top: 42px">
        <p>
          <span style="font-weight: bold;">作者：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="/about">
            白开画 and 徐威
          </a>
        </p>
        <p>
          <span style="font-weight: bold;">文章链接：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="http://www.baikaihua.gitee.io/2021/11/08/%E8%B7%AF%E7%94%B1%E4%B8%8E%E4%BA%A4%E6%8D%A2%E6%8A%80%E6%9C%AF%EF%BC%882%EF%BC%89_%E8%99%9A%E6%8B%9F%E5%B1%80%E5%9F%9F%E7%BD%91%EF%BC%88VLAN%EF%BC%89%E6%8A%80%E6%9C%AF%EF%BC%88%E4%B8%8B%EF%BC%89/index.html">
            http://www.baikaihua.gitee.io/2021/11/08/%E8%B7%AF%E7%94%B1%E4%B8%8E%E4%BA%A4%E6%8D%A2%E6%8A%80%E6%9C%AF%EF%BC%882%EF%BC%89_%E8%99%9A%E6%8B%9F%E5%B1%80%E5%9F%9F%E7%BD%91%EF%BC%88VLAN%EF%BC%89%E6%8A%80%E6%9C%AF%EF%BC%88%E4%B8%8B%EF%BC%89/index.html
          </a>
        </p>
        <p><span style="font-weight: bold;">版权声明：</span>本博客所有文章除特别声明外，均采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0 协议</a>。转载请注明出处！</p>
      </div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/2021/11/14/PHP%E5%BE%AA%E7%8E%AF%E6%8E%A7%E5%88%B6%E8%AF%AD%E5%8F%A5/index.html" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">PHP循环控制语句 </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/2021/11/06/PHP%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6%E8%AF%AD%E5%8F%A5/index.html" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">PHP流程控制 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

  <div 
    class="card card-content comment-card" 
    style="margin-top: 16px;">
    <div class="comment-card-title">评论</div>
    
  <div id="vcomments"></div>
  
  <script>
    loadScript("//unpkg.com/valine/dist/Valine.min.js");
    var oldLoadVa = window.onload;
    window.onload = function () {
      oldLoadVa && oldLoadVa();
      new Valine({
        el: '#vcomments',
        appId: 'C2ey5RzCeMGvikIpezIqS1fW-gzGzoHsz',
        appKey: 'yNj1HPpcuT4nFzgDG1hfxiwX',
        placeholder: 'Just go go',
        path: window.location.pathname,
        avatar: 'mp',
        meta: ["nick","mail","link"],
        pageSize: '10',
        lang: '',
        visitor: 'false',
        highlight: true,
        recordIP: false,
        
        
        
        enableQQ: 'false',
        requiredFields: [],
      });
    };
  </script>

  </div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#valn%E7%9A%84%E6%B7%BB%E5%8A%A0%E4%B8%8E%E5%88%A0%E9%99%A4"><span class="toc-number">1.</span> <span class="toc-text"> VALN的添加与删除</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#valn%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">1.1.</span> <span class="toc-text"> VALN常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%80%E5%9F%BA%E4%BA%8E%E7%AB%AF%E5%8F%A3%E7%9A%84vlan%E9%85%8D%E7%BD%AE"><span class="toc-number">1.2.</span> <span class="toc-text"> 实验一：基于端口的vlan配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#access%E6%8E%A5%E5%8F%A3%E4%B8%8Etrunk%E6%8E%A5%E5%8F%A3%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">2.</span> <span class="toc-text"> Access接口与Trunk接口的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5"><span class="toc-number">2.1.</span> <span class="toc-text"> 基本概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">2.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%BA%8C%E8%B7%A8%E4%BA%A4%E6%8D%A2%E6%9C%BA%E7%9A%84%E7%9B%B8%E5%90%8Cvlan%E9%80%9A%E4%BF%A1trunk"><span class="toc-number">2.3.</span> <span class="toc-text"> 实验二：跨交换机的相同vlan通信（trunk）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E7%9A%84%E5%8E%9F%E7%90%86%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-number">3.</span> <span class="toc-text"> Hybrid接口的原理与配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E5%8E%9F%E7%90%86"><span class="toc-number">3.1.</span> <span class="toc-text"> Hybrid接口原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-2"><span class="toc-number">3.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%89%E4%BA%A4%E6%8D%A2%E6%9C%BAhybrid%E6%8E%A5%E5%8F%A3%E5%AE%9E%E9%AA%8C"><span class="toc-number">3.3.</span> <span class="toc-text"> 实验三：交换机Hybrid接口实验</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A3%80%E6%9F%A5vlan%E4%BF%A1%E6%81%AF"><span class="toc-number">4.</span> <span class="toc-text"> 检查VLAN信息</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-3"><span class="toc-number">4.1.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E4%BA%8E%E5%AE%9E%E9%AA%8C%E4%B8%89%E7%9A%84%E6%A1%88%E4%BE%8B"><span class="toc-number">4.2.</span> <span class="toc-text"> 基于实验三的案例</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#gvrp%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">5.</span> <span class="toc-text"> GVRP的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E5%9B%9Bgvrp%E9%85%8D%E7%BD%AE"><span class="toc-number">5.1.</span> <span class="toc-text"> 实验四：GVRP配置</span></a></li></ol></li></ol>
</div></main>
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://gitee.com/baikaihua/tochang/raw/master/src=http___b-ssl.duitang.com_uploads_item_201607_07_20160707163006_EnLeG.jpeg&refer=http___b-ssl.duitang.jpg" 
    class="author-img" 
    alt="author avatar">

<p class="author-name">白开画 and 徐威</p>
<p class="author-description">欢迎！</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/archives">
    <span>33</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/categories">
    <span>11</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/tags">
    <span>37</span>
    <span>标签</span>
  </a>
</div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#valn%E7%9A%84%E6%B7%BB%E5%8A%A0%E4%B8%8E%E5%88%A0%E9%99%A4"><span class="toc-number">1.</span> <span class="toc-text"> VALN的添加与删除</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#valn%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">1.1.</span> <span class="toc-text"> VALN常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%80%E5%9F%BA%E4%BA%8E%E7%AB%AF%E5%8F%A3%E7%9A%84vlan%E9%85%8D%E7%BD%AE"><span class="toc-number">1.2.</span> <span class="toc-text"> 实验一：基于端口的vlan配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#access%E6%8E%A5%E5%8F%A3%E4%B8%8Etrunk%E6%8E%A5%E5%8F%A3%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">2.</span> <span class="toc-text"> Access接口与Trunk接口的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5"><span class="toc-number">2.1.</span> <span class="toc-text"> 基本概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">2.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%BA%8C%E8%B7%A8%E4%BA%A4%E6%8D%A2%E6%9C%BA%E7%9A%84%E7%9B%B8%E5%90%8Cvlan%E9%80%9A%E4%BF%A1trunk"><span class="toc-number">2.3.</span> <span class="toc-text"> 实验二：跨交换机的相同vlan通信（trunk）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E7%9A%84%E5%8E%9F%E7%90%86%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-number">3.</span> <span class="toc-text"> Hybrid接口的原理与配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E5%8E%9F%E7%90%86"><span class="toc-number">3.1.</span> <span class="toc-text"> Hybrid接口原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-2"><span class="toc-number">3.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%89%E4%BA%A4%E6%8D%A2%E6%9C%BAhybrid%E6%8E%A5%E5%8F%A3%E5%AE%9E%E9%AA%8C"><span class="toc-number">3.3.</span> <span class="toc-text"> 实验三：交换机Hybrid接口实验</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A3%80%E6%9F%A5vlan%E4%BF%A1%E6%81%AF"><span class="toc-number">4.</span> <span class="toc-text"> 检查VLAN信息</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-3"><span class="toc-number">4.1.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E4%BA%8E%E5%AE%9E%E9%AA%8C%E4%B8%89%E7%9A%84%E6%A1%88%E4%BE%8B"><span class="toc-number">4.2.</span> <span class="toc-text"> 基于实验三的案例</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#gvrp%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">5.</span> <span class="toc-text"> GVRP的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E5%9B%9Bgvrp%E9%85%8D%E7%BD%AE"><span class="toc-number">5.1.</span> <span class="toc-text"> 实验四：GVRP配置</span></a></li></ol></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/">
        <div class="categories-list-item">
          计算机网络
          <span class="categories-list-item-badge">5</span>
        </div>
      </a>
    
      <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">
        <div class="categories-list-item">
          数据库
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/PHP/">
        <div class="categories-list-item">
          PHP
          <span class="categories-list-item-badge">14</span>
        </div>
      </a>
    
      <a href="/categories/Windows%E7%B3%BB%E7%BB%9F/">
        <div class="categories-list-item">
          Windows系统
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/Python/">
        <div class="categories-list-item">
          Python
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/Linux/">
        <div class="categories-list-item">
          Linux
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/">
        <div class="categories-list-item">
          数据结构与算法
          <span class="categories-list-item-badge">2</span>
        </div>
      </a>
    
      <a href="/categories/%E7%BD%91%E7%BB%9C/">
        <div class="categories-list-item">
          网络
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/">
        <div class="categories-list-item">
          路由交换
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/%E8%BD%AC%E8%BD%BD/">
        <div class="categories-list-item">
          转载
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/python/">
        <div class="categories-list-item">
          python
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/tags/%E7%99%BD%E5%BC%80%E7%94%BB/" 
        title="白开画">
        <div class="tags-list-item">白开画</div>
      </a>
    
      <a 
        href="/tags/%E5%BE%90%E5%A8%81/" 
        title="徐威">
        <div class="tags-list-item">徐威</div>
      </a>
    
      <a 
        href="/tags/PHP/" 
        title="PHP">
        <div class="tags-list-item">PHP</div>
      </a>
    
      <a 
        href="/tags/web%E8%84%9A%E6%9C%AC/" 
        title="web脚本">
        <div class="tags-list-item">web脚本</div>
      </a>
    
      <a 
        href="/tags/%E7%BD%91%E7%BB%9C/" 
        title="网络">
        <div class="tags-list-item">网络</div>
      </a>
    
      <a 
        href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/" 
        title="计算机网络">
        <div class="tags-list-item">计算机网络</div>
      </a>
    
      <a 
        href="/tags/%E5%8D%8E%E4%B8%BA/" 
        title="华为">
        <div class="tags-list-item">华为</div>
      </a>
    
      <a 
        href="/tags/%E5%8D%8E%E4%B8%BA%E8%AE%A4%E8%AF%81/" 
        title="华为认证">
        <div class="tags-list-item">华为认证</div>
      </a>
    
      <a 
        href="/tags/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/" 
        title="路由交换">
        <div class="tags-list-item">路由交换</div>
      </a>
    
      <a 
        href="/tags/GVRP/" 
        title="GVRP">
        <div class="tags-list-item">GVRP</div>
      </a>
    
      <a 
        href="/tags/VLAN/" 
        title="VLAN">
        <div class="tags-list-item">VLAN</div>
      </a>
    
      <a 
        href="/tags/%E5%9F%BA%E7%A1%80/" 
        title="基础">
        <div class="tags-list-item">基础</div>
      </a>
    
      <a 
        href="/tags/ip/" 
        title="ip">
        <div class="tags-list-item">ip</div>
      </a>
    
      <a 
        href="/tags/%E5%A4%A7%E6%95%B0/" 
        title="大数">
        <div class="tags-list-item">大数</div>
      </a>
    
      <a 
        href="/tags/python/" 
        title="python">
        <div class="tags-list-item">python</div>
      </a>
    
      <a 
        href="/tags/%E5%91%BD%E4%BB%A4%E6%8F%90%E7%A4%BA%E7%AC%A6/" 
        title="命令提示符">
        <div class="tags-list-item">命令提示符</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#valn%E7%9A%84%E6%B7%BB%E5%8A%A0%E4%B8%8E%E5%88%A0%E9%99%A4"><span class="toc-number">1.</span> <span class="toc-text"> VALN的添加与删除</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#valn%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">1.1.</span> <span class="toc-text"> VALN常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%80%E5%9F%BA%E4%BA%8E%E7%AB%AF%E5%8F%A3%E7%9A%84vlan%E9%85%8D%E7%BD%AE"><span class="toc-number">1.2.</span> <span class="toc-text"> 实验一：基于端口的vlan配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#access%E6%8E%A5%E5%8F%A3%E4%B8%8Etrunk%E6%8E%A5%E5%8F%A3%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">2.</span> <span class="toc-text"> Access接口与Trunk接口的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5"><span class="toc-number">2.1.</span> <span class="toc-text"> 基本概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">2.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%BA%8C%E8%B7%A8%E4%BA%A4%E6%8D%A2%E6%9C%BA%E7%9A%84%E7%9B%B8%E5%90%8Cvlan%E9%80%9A%E4%BF%A1trunk"><span class="toc-number">2.3.</span> <span class="toc-text"> 实验二：跨交换机的相同vlan通信（trunk）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E7%9A%84%E5%8E%9F%E7%90%86%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-number">3.</span> <span class="toc-text"> Hybrid接口的原理与配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#hybrid%E6%8E%A5%E5%8F%A3%E5%8E%9F%E7%90%86"><span class="toc-number">3.1.</span> <span class="toc-text"> Hybrid接口原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-2"><span class="toc-number">3.2.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E4%B8%89%E4%BA%A4%E6%8D%A2%E6%9C%BAhybrid%E6%8E%A5%E5%8F%A3%E5%AE%9E%E9%AA%8C"><span class="toc-number">3.3.</span> <span class="toc-text"> 实验三：交换机Hybrid接口实验</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A3%80%E6%9F%A5vlan%E4%BF%A1%E6%81%AF"><span class="toc-number">4.</span> <span class="toc-text"> 检查VLAN信息</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-3"><span class="toc-number">4.1.</span> <span class="toc-text"> 常用命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E4%BA%8E%E5%AE%9E%E9%AA%8C%E4%B8%89%E7%9A%84%E6%A1%88%E4%BE%8B"><span class="toc-number">4.2.</span> <span class="toc-text"> 基于实验三的案例</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#gvrp%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">5.</span> <span class="toc-text"> GVRP的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E9%AA%8C%E5%9B%9Bgvrp%E9%85%8D%E7%BD%AE"><span class="toc-number">5.1.</span> <span class="toc-text"> 实验四：GVRP配置</span></a></li></ol></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-13</div>
        <a href="/2021/12/13/python%E7%88%AC%E5%8F%96%E6%B7%98%E5%AE%9D%E5%95%86%E5%93%81/index.html"><div class="recent-posts-item-content">python爬取淘宝商品</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-13</div>
        <a href="/2021/12/13/PHP%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C/index.html"><div class="recent-posts-item-content">PHP字符串常用操作</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-11-29</div>
        <a href="/2021/11/29/PHP%E8%AE%A4%E8%AF%86%E5%AD%97%E7%AC%A6%E4%B8%B2/index.html"><div class="recent-posts-item-content">PHP认识字符串</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-11-21</div>
        <a href="/2021/11/21/PHP%E5%87%BD%E6%95%B0%E7%9A%84%E5%BA%94%E7%94%A8/index.html"><div class="recent-posts-item-content">PHP函数的应用</div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2021 -
          
          2021
        </span>
        &nbsp;
        <a 
          href="/" 
          class="footer-link">
          程序小站
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
      <div class="footer-dsc">
        
          本站总访问量<span id="busuanzi_value_site_pv"></span>次
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          本站总访客数<span id="busuanzi_value_site_uv"></span>次
        
      </div>
      
    
</footer> 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton" 
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
      

  
  
    
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css">

  
 
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/js/main.js"></script> 
    
      <script> 
        loadScript('/js/lib/busuanzi.min.js') 
      </script>
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/js/lib/lozad.min.js', addLazyload)
      </script>
     
    
    
      <script>
        setTimeout(() => {localSearch("search.json")}, 0)
      </script>
    
  </body>
</html>
